function selectlocation(showdata_onlocationchange){ var dist_id = $('#district').val(); var show_all_option = $('#show_all_option').val(); jQuery.ajax({ type: "post", url: ajaxurl, data: { action: 'show_locations', dist_id: dist_id, showdata_onlocationchange :showdata_onlocationchange, show_all_option : show_all_option }, success: function(res){ var res_arr = res.split('~#$'); $('#location_near').html(res_arr[1]); } }) } function validate_form() { var district = document.getElementById('district'); var location = document.getElementById('location'); var username = document.getElementById('user_name'); var contact_no = document.getElementById('contact_no'); var description = document.getElementById('description'); var mail_id = document.getElementById('mail_id'); console.log(location.search.indexOf('type=')); if(location.search.indexOf('type=') == -1) { alert("Please select any classified type"); return false; } if(district.selectedIndex < 1) { alert("Please select district"); district.focus(); return false; } if(location.selectedIndex < 1) { alert("Please select location"); location.focus(); return false; } if(description.value == "") { alert("Please enter description"); description.focus(); return false; } if(username.value == "") { alert("Please enter your name"); username.focus(); return false; } var exp = /^[0-9]$/; if(contact_no.value == "") { alert("Please enter contact no"); contact_no.focus(); return false; } if(contact_no.value.length < 10 ||contact_no.value.length >11) { alert("Please enter correct contact no"); contact_no.focus(); return false; } if(isNaN(contact_no.value)){ alert("Please enter numbers only in contact no"); contact_no.focus(); return false; } var mailRegExp = /^.+@.+\..{2,3}$/; if (!mailRegExp.test(mail_id.value)){ alert("Please enter a valid e-mail address."); mail_id.focus(); return false; } return true; } function selectData() { var district = $('#district').val(); var location = $('#location').val(); var ad_type = $('#ad_type').val(); jQuery.ajax({ type: "post", url: ajaxurl, data: { action: 'clasified_div', district: district, location: location, ad_type: ad_type }, success: function(res){ var res_arr = res.split('~#$'); var total_srch = res.split('total:'); $('#classified').show(); $('#classified').html(res_arr[1]); $('#total_srch').text(total_srch[1]); } }) } function selectAll(){ $("INPUT[type='checkbox']").attr('checked', true); } function changestatus(id) { if(jQuery('#status' + id).is(':checked')) { var status = 1; }else { status = 0; } jQuery.ajax({ type: "post", url: ajaxurl, data: { action: 'update_status', id: id, status :status }, success: function(res){ } }) } function removerecord(id) { console.log(ajaxurl); jQuery('#button' + id).hide(); jQuery.ajax({ type: "post", url: ajaxurl, data: { action: 'delete_status', id: id }, success: function(response){ var result=response.split('!@#$'); if(result[0]) { var id=result[0]; jQuery("#article_"+id).remove(); jQuery("#message").show(500); jQuery("#message").html(result[1]); } } }) } function emailpopup(){ var n = $("input:checked").length; if(n == 0) { alert("No listing selected to mail.Please select at least one listing"); return; } else { var val = []; $(':checkbox:checked').each(function(i){ val[i] = $(this).val(); }); window.location = "mailto:"+"?subject=Himachal listing." + "&body="+val+" "+window.location; } } function print_selected_entry(){ var n = $("input:checked").length; if(n == 0) { alert("No listing selected to print.Please select at least one listing"); return; } else { var val = []; $(':checkbox:checked').each(function(i) { val[i] = $(this).val(); }); } //newWin = window.open(""); //newWin.document.write(val); // newWin.print(); // newWin.close(); newwin=window.open('','printwin','left=100,top=100'); newwin.document.write('\n
\n'); newwin.document.write('